import Cookies from 'js-cookie'

const TokenKey = 'Nuxt-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// import Cookie from 'js-cookie'

// export default {
//   //获取服务端cookie
//   getcookiesInServer:function (req) {
//     let service_cookie = {};
//     req && req.headers.cookie && req.headers.cookie.split(';').forEach(function (val) {
//       let parts = val.split('=');
//       service_cookie[parts[0].trim()] = (parts[1] || '').trim();
//     });
//     return service_cookie;
//   },
//   //获取客户端cookie
//   getcookiesInClient:function (key) {
//     return Cookie.get(key) ? Cookie.get(key) : ''
//   },
//   //设置客户端cookie
//   setcookiesInClient:function(key,token){
//     return Cookies.set(key, token)
//   },
//   removecookiesInClient:function(key){
//     return Cookies.remove(key)
//   },
// }

